package com.laoyang.Controller;

import com.laoyang.dtp.DtpExecutor;
import com.laoyang.dtp.DtpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author:Kevin
 * @create: 2023-10-24 17:05
 * @Description: 视图层
 */
@Controller("user")
public class UserController {

    @Autowired
    private DtpExecutor t1;

    @Autowired
    private DtpExecutor t2;

    @GetMapping("test")
    public Integer test(){

//        DtpExecutor t1 = DtpUtil.get("t1");
//        DtpExecutor t2 = DtpUtil.get("t2");


        t1.execute(() -> dotest());
        t2.execute(() -> dotest());

        System.out.println(t1.getCorePoolSize());
        System.out.println(t2.getCorePoolSize());
        return 1;
    }

    public void dotest(){
        System.out.println("dotest");
    }


}
